package com.hdoit.apollo.web.shop.modelconfig;

import com.hdoit.apollo.web.shop.providers.StaffRoleProvider;
import com.tennetcn.web.component.attribute.DisplayNameAttribute;
import com.tennetcn.web.component.attribute.DropDownListAttribute;
import com.tennetcn.web.component.attribute.RemoteAttribute;
import com.tennetcn.web.component.attribute.RequiredAttribute;
import com.tennetcn.web.component.attribute.base.ModelMetadataAttributeConfiguration;
import com.tennetcn.web.message.WebManageContainer;

/**
 * @author      tancongzhu
 * @email       
 * @createtime  2018年04月26日 14:48:06
 * @comment
 */
public class StaffConfig extends ModelMetadataAttributeConfiguration{
    public StaffConfig(){
        this.setProperty("name")
            .hasAttribute(new DisplayNameAttribute("姓名"))
            .hasAttribute(new RequiredAttribute("必填项"));

        this.setProperty("code")
            .hasAttribute(new DisplayNameAttribute("code"));

        this.setProperty("markCode")
            .hasAttribute(new DisplayNameAttribute("markCode"));

        this.setProperty("sex")
            .hasAttribute(new DisplayNameAttribute("性别"));

        RemoteAttribute mobileAccountRemoteAttribute=new RemoteAttribute();
        mobileAccountRemoteAttribute.setAdditionalfields("*.mobile,*.id");
        mobileAccountRemoteAttribute.setErrorMessage("已经存在相应的手机号");
        mobileAccountRemoteAttribute.setRemoteUrl(WebManageContainer.VIRTUALPATH+"/shop/staff/checkMobile");
        this.setProperty("mobile")
            .hasAttribute(new DisplayNameAttribute("电话"))
            .hasAttribute(new RequiredAttribute("必填项"))
            .hasAttribute(mobileAccountRemoteAttribute);

        this.setProperty("email")
            .hasAttribute(new DisplayNameAttribute("邮箱"));

        this.setProperty("businessId")
            .hasAttribute(new DisplayNameAttribute("公司"));

        this.setProperty("shopId")
            .hasAttribute(new DisplayNameAttribute("门店"));

        this.setProperty("qq")
            .hasAttribute(new DisplayNameAttribute("QQ"));

        this.setProperty("wechat")
            .hasAttribute(new DisplayNameAttribute("微信"));
        
        this.setProperty("roleIds")
		.hasAttribute(new DisplayNameAttribute("角色"))
		.hasAttribute(new RequiredAttribute("必填项"))
		.hasAttribute(new DropDownListAttribute(new StaffRoleProvider(),false));

    }
}
